package dataAcsessObject;

import entity.Node;
import java.util.List;
import javax.persistence.EntityManager;

/**
 *
 * @author Juan Hernández Serrato
 */
public class NodeDAO extends AbstractDataAccessObject<Node> {
    public NodeDAO(){
        super(Node.class);
    }
    
    public List<Node> findNodesByParent(int id, EntityManager em){
        return em.createNamedQuery("findNodesByParent",Node.class)
                .setParameter("padre", id)
                .getResultList();
    }
    
    public List<Node> findNodesByCourse(int id, EntityManager em){
        return em.createNamedQuery("findNodesByCourse",Node.class)
                .setParameter("idCurso", id)
                .getResultList();
    }
}
